/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2021-09-22
 * Version     : v0.1
 * Description : 
 *******************************************************************/
#ifndef _SYS_TASK_H_
#define _SYS_TASK_H_
 
/*----------------------------Head file----------------------------*/
#include "stdint.h"
#include "stdbool.h"

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/

typedef enum
{
    MSG_TYPE_NULL = 0,
    MSG_TYPE_BG,
    MSG_TYPE_UI,

    // ...
    MSG_TYPE_MAX,
} sys_msg_type_enum_t;


//Excute task in background.
typedef enum
{
    BG_EVT_NULL = 0,
    BG_EVT_BAT_ADC_CONVERT_DONE,
    BG_EVT_STORE_MEM_ERR_HDL,

    BG_EVT_BLE_UPLOAD_BATT_PER,
    BG_EVT_BLE_UPLOAD_MEM,

    BG_EVT_SHIP_MODE_ENTER,

    BG_EVT_BLE_DEV_RESET,
    BG_EVT_BLE_DEV_REVERT,
    BG_EVT_BLE_SET_ADV_NAME,

    // ...
    BG_EVT_MAX,
} bg_evt_enum_t;


typedef enum
{
    UI_EVT_NULL = 0,

    UI_EVT_UI_MIN,
    UI_EVT_SHORT_PRESS,
    UI_EVT_DOUBLE_CLICK,
    UI_EVT_LONG_PRESS,
    UI_EVT_APP_PAIR_PRESS,
    UI_EVT_SHIP_MODE_RESET,

    UI_EVT_POWERON_FULL_DISP,
    UI_EVT_CHARGING,
    UI_EVT_BATT_LOW,
    UI_EVT_DEV_SKIP_DONE,
    UI_EVT_APP_SKIP_DONE,
    UI_EVT_SEARCH_DEV,

    UI_EVT_OTA_ING,
    UI_EVT_OTA_DONE,
    UI_EVT_OTA_FAIL,

    UI_EVT_BOARD_TEST,
    UI_EVT_DEV_TEST,

    UI_EVT_ENTER_BURN_MAC_MODE,
    UI_EVT_BURN_MAC,

    UI_EVT_SKIP_CNT_DOWN_START,
    UI_EVT_SKIP_MODE_MIN,
    UI_EVT_APP_SKIP_MODE_COUNTDOWN_TIME,
    UI_EVT_APP_SKIP_MODE_COUNTDOWN_NUM,
    UI_EVT_APP_SKIP_MODE_FREE,
    UI_EVT_APP_SKIP_MODE_CUMULATIVE_NUM,
    UI_EVT_SKIP_MODE_MAX,

    // ...
    UI_EVT_MAX,
} ui_evt_enum_t;


typedef struct
{
    uint8_t msg_type;
    uint8_t evt;
} sys_evt_t;


/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/
extern void sys_task_msg_send(uint8_t type, uint8_t evt);
extern void sys_task_handle(sys_evt_t* pMsg);

/*-----------------------------------------------------------------*/

#endif
